///*****************************************************************************
//*
//*  PROJECT:     SlipStream
//*               (reflections - reflections class)
//*  LICENSE:     GNU General Public License v3 - http://www.gnu.org/licenses/gpl.html
//
//*  DEVELOPERS:  Philip Farquharson 	<B00137077@studentmail.uws.ac.uk>
//*				John Gray 			<B00145524@studentmail.uws.ac.uk>		
//*				Zohaib Bhatti		<B00104280@studentmail.uws.ac.uk>
//*				Euan Hislop 		<B00138636@studentmail.uws.ac.uk>
//*
//*****************************************************************************/

#include "reflections.h"

// constructor
reflections::reflections()
{
}

// destructor
reflections::~reflections()
{
}

// initialization
void reflections::init()
{
	m_texMirror = CTextureManager::GetSingletonPtr()->FindTexture("textures/marble.png");
}

// draw wall
void reflections::drawFloor()
{
	glPushMatrix();
		glEnable(GL_TEXTURE_2D);
		glDisable(GL_LIGHTING);		// Disable Lighting in the scene
		glDisable(GL_LIGHT0);		// Disable the first light in the scene
		
		glScalef(3.0f ,0.0f ,3.0f);
		m_texMirror->BindTexture();
		// controlling the alpha of the wall with color4f
		glColor4f(1.0f, 1.0f, 1.0f, 0.9f);

		glBegin(GL_QUADS);							// Begin drawing a quad
			glNormal3f(0.0f, 1.0f, 0.0f);				// Normal pointing up
			glTexCoord2f(1.0f, 1.0f);				// Bottom right of texture
			glVertex3f( 25.0f, 0.0f, 25.0f);				// Bottom right corner of floor
			glTexCoord2f(1.0f, 0.0f);				// Top right of texture
			glVertex3f( 25.0f, 0.0f,-25.0f);				// Top right corner of floor
			glTexCoord2f(0.0f, 0.0f);				// Top left of texture
			glVertex3f(-2.0f, 0.0f,-25.0f);				// Top left corner of floor
			glTexCoord2f(0.0f, 1.0f);				// Bottom left of texture
			glVertex3f(-2.0f, 0.0f, 25.0f);				// Bottom left corner of floor
		glEnd();
		
	glPopMatrix();
}

void reflections::drawWall()
{
	glPushMatrix();
		glEnable(GL_TEXTURE_2D);
		glDisable(GL_LIGHTING);
		glDisable(GL_LIGHT0);
		glScalef(3.0, 1.0, 3.0);
		m_texMirror->BindTexture();	
		// controlling the alpha of the wall with color4f
		glColor4f(1.0f, 1.0f, 1.0f, 0.9f);

		
		glBegin(GL_QUADS);
			// north wall
			glNormal3f(1.0f, 0.0f, 0.0f);
			glTexCoord2f(1.0f, 1.0f);
			glVertex3f(-2.0f, 0.0f, 25.0f);
			glTexCoord2f(0.0f, 1.0f);
			glVertex3f(-2.0f, 0.0f, -25.0f);
			glTexCoord2f(0.0f, 0.0f);
			glVertex3f(-2.0f, 45.0f, -25.0f);
			glTexCoord2f(1.0f, 0.0f);
			glVertex3f(-2.0f, 45.0f, 25.0f);

			//// west
			glNormal3f(1.0f, 0.0f, 0.0f);
			glTexCoord2f(1.0f, 1.0f);
			glVertex3f(-2.0f, 0.0f, 25.0f);
			glTexCoord2f(0.0f, 1.0f);
			glVertex3f(25.0f, 0.0f, 25.0f);
			glTexCoord2f(0.0f, 0.0f);
			glVertex3f(25.0f, 45.0f, 25.0f);
			glTexCoord2f(1.0f, 0.0f);
			glVertex3f(-2.0f, 45.0f, 25.0f);

		glEnd();

	glPopMatrix();
}
